package com.ybkj.daijia.server.service.impl;

import com.ybkj.daijia.server.mapper.OrderLocationManyMapper;
import com.ybkj.daijia.server.model.OrderLocation.OrderType;
import com.ybkj.daijia.server.model.OrderLocationMany;
import com.ybkj.daijia.server.service.OrderLocationManyService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class DefaultOrderLocationManyService implements OrderLocationManyService {

    @Autowired
    private OrderLocationManyMapper orderLocationManyMapper;

    @Transactional(rollbackFor = Exception.class)
    public OrderLocationMany save(OrderLocationMany orderLocationMany) {
        if (orderLocationMany != null && null != orderLocationMany.getJsonLocs()) {
            orderLocationManyMapper.insertRecord(orderLocationMany);
        }
        return orderLocationMany;
    }

    @Override
    public List<OrderLocationMany> selectByOrderTypeAndOrderId(OrderType orderType, Long orderId) {
        return orderLocationManyMapper.selectByOrderTypeAndOrderId(orderType, orderId);
    }


}
